<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>04 侧边栏效果</title>
		<style type="text/css">
			*{
				padding: 0;
				margin: 0;
			}
			#box{
				width: 200px;
				height: 200px;
				background-color: red;
				position: relative;
				left: -200px;
			}
			#box span{
				position: absolute;
				width: 40px;
				height: 60px;
				color: #fff;
				background-color: #000000;
				right: -40px;
				top: 50%;
				margin-top: -30px;
				line-height: 60px;
				text-align: center;
			}
		</style>
	</head>
	<body>
		<div id="box">
			<span>拉开</span>
		</div>
		<script type="text/javascript">
			// -200    0
			window.onload = function (){
				var box = document.getElementById('box');
				box.onmouseover = function (){
					this.style.left = 0 + 'px';
				}
				box.onmouseout = function (){
					this.style.left = -200 + 'px';
				}
			}
		</script>
	</body>
</html>
